<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<br>
<script type="text/javascript">
function memExitCheck(m_num){
	if(confirm("정말로 탈퇴시키겠습니까?")){
			location.href="memberResign.do?m_num="+m_num;
		}
		return false;
	}

function memDeleteCheck(m_num){
	if(confirm("회원을 삭제하시겠습니까?")){
		location.href="memberDelete.do?m_num="+m_num;
		}
		return false;
	}		  
</script>
<form action="memberlist.do" name="search" method="get" onsubmit="return searchCheck()">

<table width="200" align="center" border="0" cellspacing="0" cellpadding="2">
	<tr>
		<td align="center">
			<select name="keyField">
				<option value="m_address">주소</option>
				<option value="m_name">이름</option>
				<option value="m_level">등급</option>
				<option value="all">전체</option>
			</select>
		</td>
		<td>
			<input type="text" size="16" name="keyWord">
		</td>
		<td>
			<input type="submit" value="찾기">
		</td>
		
	</tr>
<div align="center">
<font color="red" style="font-weight: bold">${msg }</font>
</div>
</table>
</form>
<table width="80%" border="1" cellspacing="0" cellpadding="2" align="center">
  
	<tr bgcolor="#F3F3F3">
		<th width="30">번호</th>
		<th width="50">아이디</th>
		<th width="50">이름</th>
		<th width="60">생년월일</th>
		<th width="80">전화번호</th>
		<th>주소</th>
		<th width="60">이메일</th>
		<th width="40">등급</th>
		<th width="60">가입날짜</th>
		<th width="120px">회원관리</th>
	</tr>
	<c:if test="${count==0}">
		<tr>
			<td colspan="10" align="center">현재 가입된 회원이 없습니다.</td>
		</tr>
	</c:if>
	<c:forEach var="article" items="${list}" varStatus="status">
		<tr>
			<td align="center">${status.index+1}</td>
			<td><a href="mypage.do?seq=${status.index+1}&&m_numS=${article.m_num}">${article.m_id}</a></td>
			<td>${article.m_name}</td>
			<td>${article.m_jumin}</td>
			<td>${article.m_phone}</td>
			<td>${article.m_address}</td>
			<td>${article.m_email}</td>
			<td align="center">
			<c:if test="${article.m_level == 1}">일반</c:if>
			<c:if test="${article.m_level == 2}">매니저</c:if>
			<c:if test="${article.m_level == 3}">사장</c:if><c:if test="${article.m_level > 3}">관리자</c:if>
			</td>
			<td align="center">${article.m_regdate}</td>
			
			<td>
			<c:if test="${article.m_resign == 1 }">
				<input type="button" value="회원탈퇴" onclick="return memExitCheck(${article.m_num})" style="width: 120px;height: 22px;background-color: yellow;color: blue;font-weight: bold">
			</c:if>
			<c:if test="${article.m_resign == 2 }">
				<input type="button" value="회원삭제" onclick="return memDeleteCheck(${article.m_num})" style="width: 120px;height: 22px;background-color: red;color: white;font-weight: bold">
			</c:if>
			</td>		
		</tr>
	</c:forEach>
	<tr>
		<td align="center" colspan="10">${pagingHtml}</td>
	</tr>
</table>





